package data;

import java.io.Serializable;
import java.sql.Date;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.*;

/**
 *
 * @author Michal Hanzlik, Tomas Jiran
 */
/*
 create table Herec (
 id_osoby             INT4                 not null,
 datum_narozeni       DATE                 null,
 constraint PK_HEREC primary key (id_osoby)
 );
 */

@Entity
@Table(name = "herec")
@DiscriminatorValue("HEREC")
public class Herec extends Osoba implements Serializable {
    /**
     * datum_narozeni DATE null,
     */
    @Column()
    private java.sql.Date datum_narozeni;
    
    @ManyToMany(mappedBy="herci")
    private List<Film> filmy;

    public Herec() {
        filmy = new ArrayList<>();
    }

    public Herec(int ID_o) {
        super(ID_o);
    }
    
    @Override
    public String toString() {
      return getJmeno()+" "+getPrijmeni();    
    }

    public Herec(Date datum_narozeni, int ID_o, String jmeno, String prijmeni) {
        super(ID_o, jmeno, prijmeni);
        this.datum_narozeni = datum_narozeni;
    }

    public Date getDatum_narozeni() {
        return datum_narozeni;
    }

    public void setDatum_narozeni(Date datum_narozeni) {
        this.datum_narozeni = datum_narozeni;
    }

    public void setFilmy(List<Film> filmy) {
        this.filmy = filmy;
    }

    public List<Film> getFilmy() {
        return filmy;
    }
}